/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.mocamorena.control;

import br.com.mocamorena.exception.PersistenciaException;
import br.com.mocamorena.model.Endereco;
import br.com.mocamorena.persistence.DaoFactory;
import br.com.mocamorena.persistence.DaoFactoryImpl;
import br.com.mocamorena.persistence.dao.EnderecoDao;
import java.util.List;

/**
 *
 * @author Diego
 */
public class ControleEndereco {

    private EnderecoDao dao;

    public ControleEndereco() {
        DaoFactory daoFactory = new DaoFactoryImpl();
        dao = daoFactory.createEnderecoDao();
    }

    public boolean inserir(Endereco endereco) throws PersistenciaException {
        return dao.inserir(endereco);
    }

    public boolean atualizar(Endereco endereco) throws PersistenciaException {
        return dao.atualizar(endereco);
    }

    public boolean excluir(Endereco endereco) throws PersistenciaException {
        return dao.excluir(endereco);
    }

    public List<Endereco> listarPeloCep(String cep) throws PersistenciaException {
        return dao.listarPeloCep(cep);
    }

    public List<Endereco> listarPeloLogradouro(String logradouro) throws PersistenciaException {
        return dao.listarPeloLogradouro(logradouro);
    }

    public List<Endereco> listarPeloBairro(String bairro) throws PersistenciaException {
        return dao.listarPeloBairro(bairro);
    }
}
